<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模拟客户端</title>
    <script src="/static/bflow/assets/js/scriptLib.js"></script>
    <!-- bootstrap-chosen -->
    <link rel="stylesheet" href="/static/bflow/assets/components/bootstrap4c-chosen/css/component-chosen.min.css">
    <script src="/static/bflow/assets/components/bootstrap4c-chosen/chosen.jquery.js"></script>
    <!-- bootstrap-validator -->
    <script src="https://cdn.bootcss.com/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script>
    <script src="/static/bflow/assets/components/mock/mock.js"></script>
    <script src="/static/bflow/assets/components/mock/MockUtil.js"></script>
    <script type="text/javascript">
        $(function () {

            SelectUtil.initSelectList("procKey", "/bflow/defineProcess/getSelectList");

            // 表单验证 http://1000hz.github.io/bootstrap-validator/
            $('#inputForm').validator().on('submit', function (e) {
                if (e.isDefaultPrevented()) {
                    // handle the invalid form...
                } else {
                    //防止重复提交
                    FormUtil.blockRepeatSubmit($('#inputForm'), 2000);

                    var paramArr = $("#inputForm").serialize()
                    HttpUtil.ajaxAsyncJsonPost("/bflow/test/startProcess", paramArr, function(message){
                        dialogTipSuccess(message);
                        refreshPage(1500);
                    });
                    return false;
                }
            })

            //输入框 x
            $("input").each(function () {
                $(this).clearSearch({
                    callback: function() {console.log("cleared");}
                });
            });

        });

        //生成 议标业务数据
        function genNegBizData(){
            //json{字段：类型}
            //类型: cname、ctitle、idcard、uuid、city、province、email、ip、domain、url、datetime、date、int、long、float
            var json = {"extBigint1": "long", "extBigint2": "int", "extVarchar1": "ctitle", "extVarchar2": "city",
                "extVarchar3": "uuid", "extVarchar4": "url", "extVarchar5": "idcard",
                "extDatetime1": "date", "extDatetime2": "datetime", "extNumeric1": "float"};
            genBizData(json);
        }
    </script>
</head>
<body>
<div class="container">
    <div class="page-header">
        <h1>模拟客户端
            <small><a href="/index.html" class="btn btn-link">首页</a></small>
        </h1>
    </div>
    <form id="inputForm" role="form" class="form-horizontal">
        <div class="row">
            <div class="form-group">
                <label class="col-sm-3 control-label">流程<span class="required">*</span>：</label>
                <div class="col-sm-4">
                    <select id="procKey" name="procKey" class="form-control" style="display: none;" required></select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">业务类型KEY<span class="required">*</span>：</label>
                <div class="col-sm-4">
                    <input type="text" name="busiKey" pattern="^[_A-z]{1,}$" class="form-control" placeholder="" required>
                    <span class="help-block m-b-none">唯一标识，使用英文命名</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">业务ID<span class="required">*</span>：</label>
                <div class="col-sm-4"><input type="text" name="busiId" class="form-control" required></div>
                <div class="col-sm-5" data-mock-btns="int,long"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">子业务ID：</label>
                <div class="col-sm-4"><input type="text" name="busiSubId" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="int,long"></div>
            </div>
            <hr>
            <div class="form-group">
                <label class="col-sm-offset-3 help-block">扩展字段 主要用于业务列表展示
                    <button type="button" class="btn btn-warning btn-xs" onclick="genNegBizData()">议标数据生成</button>
                </label>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展long字段1：</label>
                <div class="col-sm-4"><input type="text" name="extBigint1" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="int,long"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展long字段2：</label>
                <div class="col-sm-4"><input type="text" name="extBigint2" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="int,long"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展long字段3：</label>
                <div class="col-sm-4"><input type="text" name="extBigint3" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="int,long"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展long字段4：</label>
                <div class="col-sm-4"><input type="text" name="extBigint4" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="int,long"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展字符字段1：</label>
                <div class="col-sm-4"><input type="text" name="extVarchar1" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="word,ctitle,cname,idcard,uuid,city,province,email,url,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展字符字段2：</label>
                <div class="col-sm-4"><input type="text" name="extVarchar2" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="word,ctitle,cname,idcard,uuid,city,province,email,url,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展字符字段3：</label>
                <div class="col-sm-4"><input type="text" name="extVarchar3" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="word,ctitle,cname,idcard,uuid,city,province,email,url,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展字符字段4：</label>
                <div class="col-sm-4"><input type="text" name="extVarchar4" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="word,ctitle,cname,idcard,uuid,city,province,email,url,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展字符字段5：</label>
                <div class="col-sm-4"><input type="text" name="extVarchar5" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="word,ctitle,cname,idcard,uuid,city,province,email,url,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展字符字段6：</label>
                <div class="col-sm-4"><input type="text" name="extVarchar6" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="word,ctitle,cname,idcard,uuid,city,province,email,url,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展date字段1：</label>
                <div class="col-sm-4"><input type="text" name="extDatetime1" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="datetime,date"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展date字段2：</label>
                <div class="col-sm-4"><input type="text" name="extDatetime2" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="datetime,date"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展Numeric字段1：</label>
                <div class="col-sm-4"><input type="text" name="extNumeric1" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="float,int"></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">扩展Numeric字段2：</label>
                <div class="col-sm-4"><input type="text" name="extNumeric2" class="form-control"></div>
                <div class="col-sm-5" data-mock-btns="float,int"></div>
            </div>

            <div class="form-group">
                <div class="col-sm-12 col-sm-offset-3">
                    <button class="btn btn-primary" type="submit">创建</button>
                </div>
            </div>
        </div>
    </form>
</div>
</body>
</html>

